# -*- coding: utf-8 -*-

from rest_framework.decorators import action
from core.viewset import CustomModelViewSet
from core.response import JsonResponse
from apps.sys.models import DictType, DictData
from apps.sys.dict.serializers import *
from apps.sys.dict.filters import *


class DictTypeViewSet(CustomModelViewSet):
    """
    字典管理接口
    list:查询
    create:新增
    update:修改
    retrieve:单例
    destroy:删除
    """

    queryset = DictType.objects.all()
    serializer_class = DictTypeSerializer
    filterset_class = DictTypeFilterSet
    update_serializer_class = DictTypeSerializer


class DictDataViewSet(CustomModelViewSet):
    """
    字典管理接口
    list:查询
    create:新增
    update:修改
    retrieve:单例
    destroy:删除
    """

    queryset = DictData.objects.all()
    serializer_class = DictDataSerializer
    filterset_class = DictDataFilterSet
